<%-- 
    Document   : search
    Created on : 8 mai 2010, 15:20:21
    Author     : coralie
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>VOD World</title>
        <link rel=stylesheet type="text/css" href="style.css">
    </head>
    <body>
        <div id="container">
        <%@ include file="header.jsp"%>
            <%@ page import="java.util.List"%>
            <%@ page import="java.util.ArrayList"%>
            <%@ page import="java.util.Iterator"%>
            <%@ page import="ClassPackage.*" %>
            <%@page  import="org.hibernate.HibernateException" %>
            <%@page  import="org.hibernate.SessionFactory" %>
            <%@page  import="java.util.Set"%>
            <%@page  import="java.lang.String" %>

            <jsp:useBean id = "film" class="ClassPackage.Film" scope  = "request" />
            <% /*response.getWriter().println("<h1>"+ (String)request.getAttribute("genre")+"</h1>");*/
              List lst =  film.getListFilm( (SessionFactory)request.getAttribute("SessionFact"),(String)request.getAttribute("Titre"),(String)request.getAttribute("real"),(String)request.getAttribute("genre"));
             //  out.println("<h1>"+lst.size()+"</h1>");
            Set st; /*,(String)request.getAttribute("real"));*/ %>
            <div id="main" width="800px">
                <div id="column_left">
                    <form name="result" action="">
                        <table border="1">
                            <thead>
                                <tr>
                                    <th id="col">Film</th>
                                    <th>Affiche</th>
                                </tr>
                            </thead>
                            <tbody>
                                <%  
                                if(!lst.isEmpty())
                                {   Iterator it = lst.iterator();
                                    Iterator set;
                                    while(it.hasNext())
                                    {
                                        film = (Film)it.next();
                                        st=film.getDirector();
                                        set = st.iterator();
                                %>
                                    <tr>
                                        <td id="col">
                                        <a id="titreFilm"href="ControlerServlet?Operation=820&id_flm=<%out.println(film.getID());%>"><% out.println(film.getTitre()); %></a><br>
                                        <label id="genreFilm"><%out.println(film.getGenre().getName());%></label><br>
                                        <label id="realFilm"><% 
                                                    if(set.hasNext())
                                                    {
                                                        out.println( ( (Personne)set.next() ).getName());
                                                    }%>
                                        </label>
                                        <label id="acteurFilm"><%
                                                    st=film.getActor();
                                                    set = st.iterator();
                                                    if(set.hasNext())
                                                    {
                                                        out.println( ( (Personne)set.next() ).getName());
                                                    }%>
                                        </label><br>
                                     </td>

                                     <td><a id="titreFilm"href="ControlerServlet?Operation=820&id_flm=<%out.println(film.getID());%>"><img src="images/<%out.println(film.getUrl_small_picture());%>" height="99" width="73" alt="silent"></a>
                                     </td>
                                    </tr>
                                <%
                                    }
                                }
                                %>
                            </tbody>
                        </table>
                    </form>
                </div>
                <div id="column_right">
                    <form name="search" action="ControlerServlet">
                        Search :
                        <p><p><br>
                        <label for="title">Title</label><br>
                        <input type="text" id="title" value="" name="title" /><br>
                        </p>

                        <p><p><br>
                        <label for="genre">Genre</label><br>
                        <select name="genre" size="4">
                            <option>Action</option>
                            <option>Comique</option>
                            <option>Horreur</option>
                            <option>Drame</option>
                        </select>
                        <br>
                        </p>

                        <input type="hidden" name="Operation" value=5 />
                        <p>
                        <div style="margin-left: 150px;"><br>
                        <input type="submit"
                               value="Submit"
                               onclick=/>
                            <br>
                           
                        </div>
                    </form>
                </div>
                <div class="spacer"/>
            </div>
            <div id="footer">
                Site fait par Yves Derkac et Coralie Vessières
            </div>
        </div>
    </body>
</html>
